<?php

error_reporting(E_ALL);

/**
 * untitledModel - class.ModeloActividades.php
 *
 * $Id$
 *
 * This file is part of untitledModel.
 *
 * Automatically generated on 06.12.2011, 16:06:23 with ArgoUML PHP module 
 * (last revised $Date: 2010-01-12 20:14:42 +0100 (Tue, 12 Jan 2010) $)
 *
 * @author firstname and lastname of author, <author@example.org>
 */

if (0 > version_compare(PHP_VERSION, '5')) {
    die('This file was generated for PHP 5');
}

/**
 * include Conexion
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.Conexion.php');

/* user defined includes */
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2B-includes begin
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2B-includes end

/* user defined constants */
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2B-constants begin
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2B-constants end

/**
 * Short description of class ModeloActividades
 *
 * @access public
 * @author firstname and lastname of author, <author@example.org>
 */
class ModeloActividades
    extends Conexion
{
    // --- ASSOCIATIONS ---


    // --- ATTRIBUTES ---

    // --- OPERATIONS ---

    /**
     * Short description of method GetAllRows
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function GetAllRows()
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B52 begin
		$sql = "SELECT * from actividades;";		
		return $this->ejecutarQuery($sql);
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B52 end
    }

    /**
     * Short description of method GetId
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function GetId($id)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B54 begin
		$sql = "SELECT * FROM actividades where idactividad=".$id;		
		return $this->ejecutarQuery($sql);
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B54 end
    }

    /**
     * Short description of method InsertRow
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function InsertRow($datos)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B56 begin
		$sql = "INSERT INTO actividades (
			nombre,
			descrip
			) VALUES (
			'".$datos['nombre']."',
			'".$datos['descrip']."'		
			)";
		$this->ejecutarQuery($sql);
		return mysql_insert_id();    
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B56 end
    }

    /**
     * Short description of method UpdateRow
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function UpdateRow($datos)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B58 begin
		$sql= "
			UPDATE actividades SET 
				nombre = '".$datos['nombre']."',
				descrip = '".$datos['descrip']."'
				where idactividad=".$datos['idactividad'].";
		";
		$this->ejecutarQuery($sql); 
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B58 end
    }

    /**
     * Short description of method DeleteRow
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function DeleteRow($id)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B5A begin
		$sql= "DELETE FROM actividades WHERE idactividad=".$id;
		$this->ejecutarQuery($sql);
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B5A end
    }

    /**
     * Short description of method SearchByName
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function SearchByName($nombre)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B5C begin
		$sql= "SELECT * FROM actividades where nombre='".$nombre."'";
		$this->ejecutarQuery($sql);
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B5C end
    }

} /* end of class ModeloActividades */

?>